/********************************************************/
/*	Copyright (C) 2012 Gong Li Bin			*/
/*	Project:	MapReduce			*/
/*	Author:		gong_libin			*/
/*	Date:		2012_01_31			*/
/*	File:		MrCmd.h				*/
/********************************************************/

#ifndef _MRCMD_H
#define	_MRCMD_H

#include "MrPro.h"
#include <arpa/inet.h>

#define	MR_CMD				32

#define	MR_AVG				0x01
#define	MR_AVG_M01			0x02
#define	MR_AVG_M05			0x03
#define	MR_AVG_M15			0x04
#define	MR_AVG_CMD                      "uptime"

#define	MR_IOS				0x11
#define	MR_IOS_RRQ			0x12
#define	MR_IOS_WRQ			0x13
#define	MR_IOS_R_S			0x14
#define	MR_IOS_W_S			0x15
#define	MR_IOS_RSE			0x16
#define	MR_IOS_WSE			0x17
#define	MR_IOS_RKB			0x18
#define	MR_IOS_WKB			0x19
#define	MR_IOS_RQS			0x1a
#define	MR_IOS_QUS			0x1b
#define	MR_IOS_WAI			0x1c
#define	MR_IOS_SVC			0x1e
#define	MR_IOS_UTL			0x1f
#define	MR_IOS_CMD			"iostat -dx"

#define	MR_CPU				0x21
#define	MR_CPU_USR			0x22
#define	MR_CPU_NIC			0x23
#define	MR_CPU_SYS			0x24
#define	MR_CPU_IOW			0x25
#define	MR_CPU_IRQ			0x26
#define	MR_CPU_SOF			0x27
#define	MR_CPU_STE			0x28
#define	MR_CPU_IDL			0x29
#define	MR_CPU_INT			0x30
#define	MR_CPU_CMD                      "mpstat"

#define	MR_MMR				0x31
#define	MR_MMR_MMR			0x32
#define	MR_MMR_SWP			0x33
#define	MR_MMR_TTL			0x34
#define	MR_MMR_USE			0x35
#define	MR_MMR_FRE			0x36
#define	MR_MMR_CMD			"free"

#define	MR_DSK				0x41
#define	MR_DSK_TTL			0x42
#define	MR_DSK_USE			0x43
#define	MR_DSK_FRE			0x44
#define	MR_DSK_MNT			0x45
#define	MR_DSK_CMD			"df"

typedef struct tagMrCmdKey
{
	char* m_pszKey;
	UINT m_uiIndex;
}MRCMDKEY_S;

class CMrCmd
{
public:
	CMrCmd();
	virtual ~CMrCmd();

	void MrCmdKeyReset();
	void MrCmdValReset();
	void MrCmdKey(char* pszLine);
	void MrCmdVal(char* pszLine);
	void MrCmdLine(char* pszResult);

	virtual void MrCmdResultReset() { return; }
	virtual void* MrCmdResultGet() { return NULL; }
	virtual void MrCmdResultSet(void* pResult) { return; }

	virtual void MrCmdDisplay() { return; }
	virtual void MrCmdInfo(char* pszResult) { return; }
	virtual void MrCmdResultInput(UCHAR* puszBuffer, int iLength) { return; }
	virtual int MrCmdResultOutput(UCHAR* puszBuffer, USHORT* pusTotal) { return MR_SUCCESS; }

protected:
	char* m_pszKey[MR_CMD];
	char* m_pszVal[MR_CMD];
	char* m_pszLine[MR_CMD];

private:

};

#endif /* _MRCMD_H */
